//
//  JGTView.m
//  RunningMan
//
//  Created by JGT on 16/6/2.
//  Copyright © 2016年 WSJ. All rights reserved.
//

#import "JGTView.h"
#import "UILabel+JGTLabel.h"
//左右边界
static CGFloat inset = 20;
//label高
static CGFloat labelHeight = 40;
//温度的label高
static CGFloat tempLabelHeight = 110;


@implementation JGTView
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        //添加 button的frame
        CGRect frame = CGRectMake(0, inset,labelHeight, labelHeight);
        self.menuButton = [[UIButton alloc] initWithFrame:frame];
        [self.menuButton setImage:[UIImage imageNamed:@"homepage_leftitem"] forState:UIControlStateNormal];
        [self addSubview:self.menuButton];
        //添加 cityLabel
        self.cityLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, inset, (SCREEN_WIDTH), labelHeight)];
        self.cityLabel.text = @"Loading";
        self.cityLabel.textAlignment = NSTextAlignmentCenter;
        self.cityLabel.textColor = [UIColor whiteColor];
        [self addSubview:self.cityLabel];
        
        //添加iconView
        self.iconView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"999"]];
        CGRect frameIcon = self.iconView.frame;
        frameIcon = CGRectMake(SCREEN_WIDTH / 2 - 50, 100, labelHeight, labelHeight);
        self.iconView.frame = frameIcon;
        [self addSubview:self.iconView];
        
        //添加 conditionsLabel
        CGRect conditionsLabeFrame = CGRectMake(SCREEN_WIDTH / 2, 100, SCREEN_WIDTH-2*inset-labelHeight, labelHeight);
        self.conditionsLabel = [UILabel setLabelWithFrame:conditionsLabeFrame];
        self.conditionsLabel.text = @"Clear";
        [self addSubview:self.conditionsLabel];
        
        //添加temperatureLabel
        self.temperatureLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 50, 150, tempLabelHeight, tempLabelHeight)];
        self.temperatureLabel.text = @"0˚";
        self.temperatureLabel.font = [UIFont fontWithName:@"HelveticaNeue-BoldItalic" size:95];
        self.temperatureLabel.textColor = [UIColor whiteColor];
        [self addSubview:self.temperatureLabel];
        
        //添加hiloLabel
        self.hiloLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 50, 250, SCREEN_WIDTH-inset*2, labelHeight)];
        self.hiloLabel.text = @"0˚/0˚";
        self.hiloLabel.textColor = [UIColor whiteColor];
        self.hiloLabel.font = [UIFont systemFontOfSize:30];
        [self addSubview:self.hiloLabel];
        
        

        
        
    }
    
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
